﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Text;

namespace PCS.DTO
{
    public class ViewModel : INotifyPropertyChanged
    {
        public ViewModel()
        {
            this.TaskInfos = new ObservableCollection<TaskInfoDTO>();
            //for (int i = 0; i < 10; i++)
            //{
            //    TaskInfos.Add(new TaskInfoDTO
            //    {
            //        Task_Id = 12222 + i,
            //        MATENUMBER = "st-1234523123" + i,
            //        OPERNUMBER = "GX005",
            //        WORKORDERNUMBER = "S12345",
            //        QTY = 8,
            //        State = 1,
            //        Bgein_Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            //        End_Date = "",
            //        Remark = "",
            //        Create_Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            //        Create_UserId = "admin",
            //        Bar_Code = "#dda1245",
            //        AGV_OrderId = 1879,
            //        BindingOrder = "0"
            //    });
            //}
            
        }

        private ObservableCollection<TaskInfoDTO> taskInfos;

        public ObservableCollection<TaskInfoDTO> TaskInfos
        {
            get { return taskInfos; }
            set { taskInfos = value; OnPropertyChanged("TaskInfos"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(string name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(name));
            }
        }
    }
}
